<!-- // $num1 = $_GET['num1'];
// $num2 = $_GET['num2'];

// $num1 = $_REQUEST['num1'];
// $num2 = $_REQUEST['num2'];
// var_dump($_REQUEST); -->
<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>登陆界面</title>
</head>
<body>
    <form method = "get">
        账号: <input type="text" name = "user">
        密码: <input type="password" name = "pass">
        <input type = "submit" value = '登陆'>
</body>
</html>


<?php
// @$user = $_GET['user'];
// @$pass = $_GET['pass'];
// // echo $user;
// if($user == 'lyy' && $pass =='123456'){
//     echo '登陆成功';
// }
// else{
//     echo '登陆失败';
// }
$conn = mysqli_connect('127.0.0.1', 'root', 'root', 'lyy');
if (!$conn) {
    die("连接失败: " . mysqli_connect_error());
}
@$user = $_GET['user'];
@$pass = $_GET['pass'];
$sql = "select * from lyy where user='$user' and password='$pass'";
// echo $sql;
$result = mysqli_query($conn, $sql);
$row = mysqli_fetch_array($result);
// var_dump($row);
if($row){
    echo '<script>alert("登陆成功")</script>';
}
else{
    echo '<script>alert("账号或密码错误")</script>';
}
?>